package com.peanut.baby.model;

import com.google.gson.annotations.SerializedName;
import com.peanut.devlibrary.util.StringUtil;

/**
 * Created by anonymouslystudio on 2017/8/10.
 */

public class QA {

    @SerializedName("id")
    public int id;
    @SerializedName("creatorId")
    public int creatorId;
    @SerializedName("creatorAvatar")
    public String creatorAvatar;
    @SerializedName("creatorNickname")
    public String creatorNickname;
    @SerializedName("creatorName")
    public String creatorName;
    @SerializedName("answerTime")
    public long answerTime;
    @SerializedName("createTime")
    public long createTime;
    @SerializedName("title")
    public String title;
    @SerializedName("type")
    public String type;
    @SerializedName(value="desc",alternate = {"description"})
    public String description;
    @SerializedName("imageUrl")
    public String imageUrl;
    @SerializedName("audioUrl")
    public String audioUrl;
    @SerializedName("duration")
    public int duration;
    @SerializedName("doctorId")
    public int doctorId;
    @SerializedName("listenCount")
    public int listenCount;
    @SerializedName("praiseCount")
    public int praiseCount;
    @SerializedName("commentCount")
    public int commentCount;
    @SerializedName("doctorName")
    public String doctorName;
    @SerializedName("doctorNickname")
    public String doctorNickname;
    @SerializedName("doctorAvatar")
    public String doctorAvatar;
    @SerializedName("listenScore")
    public String listenScore;
    @SerializedName("praiseFlag")
    public int praiseFlag;
    @SerializedName("isPay")
    public int isPay;


    public String getStatusString(){
        if(!isAnswered()){
            return "待回答";
        }
        return doctorNickname+"已回答";
    }

    public String getPriceString(){
        if(StringUtil.isNullOrEmpty(listenScore) || listenScore.equals("0")){
            return "免费";
        }
        return listenScore+"花生壳";
    }

    public boolean isAnswered(){
        return !StringUtil.isNullOrEmpty(doctorNickname);
    }

    public boolean isPraised(){
        return praiseFlag == 1;
    }
}
